package com.huadao.pda.data.http;

import io.reactivex.functions.Function;

public class HttpFunction<T> implements Function<BaseResponse<T>,T> {
    @Override
    public T apply(BaseResponse<T> response) throws Exception {
        if (!response.isRequestSuccess()) {
            throw new ApiException(response.getCode(), String.valueOf(response.getMessage()));
        }
        return response.getData();
    }
}
